package com.yqg.protection.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yqg.protection.entity.Client;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zxf
 * @since 2024-07-24
 */
@Mapper
public interface ClientMapper extends BaseMapper<Client> {

    List<Client> getClientsByOrganId(Integer pageNum, Integer pageSize, Long organizationId, String name, String address, Integer level, String isAllClient, List<Long> clientIds);

    Long getClientsCountByOrganId(Long organizationId, String name, String address, Integer level, String isAllClient, List<Long> clientIds);

    List<Client> getClientsByName(Long organizationId, String name, Integer level, String isAllClient, List<Long> clientIds);

    Double overallScore(Long organizationId, Integer level, String isAllClient, List<Long> clientIds, Long clientId);

    List<Client> exportData(Long organizationId, String name, String address, Integer level, String isAllClient, List<Long> clientIds);

    List<Client> selectAll(Integer level, Long organizationId, String isAllClient, List<Long> clientIds);

    List<Client> getSubordClient(Integer pageNum, Integer pageSize, Long organizationId, String name, String address, Integer level);

    Long getSubordClientCount(Long organizationId, String name, String address, Integer level);

    @Select("select monitorkey from client where id = (select client_id from equipment_input_store where id = #{equipmentInputStoreId})")
    String getMonitorkeyByEquip(Long equipmentInputStoreId);
}
